/**
 * 
 */
package com.cqcis.uip.base.framework.service.impl;

import java.util.List;

import com.cqcis.uip.base.framework.common.InterfaceLog;
import com.cqcis.uip.base.framework.service.InterfaceLogService;

/**
 * @author huangmy
 * @date 2008-2-14
 */
public class DefaultInterfaceLogService implements InterfaceLogService {
	private InterfaceLogService intfLogService; // LOG
	
	public String getCurrentTime() {		
		return null;
	}
	
	public DefaultInterfaceLogService() {		
	}
	
	public DefaultInterfaceLogService(InterfaceLogService intfLogService) {
		if (intfLogService == null) {
			throw new NullPointerException("Can't be null");
		}
		
		this.intfLogService = intfLogService;
	}

	public void insert(InterfaceLog log) {
		if (log == null) {
			return;
		}
		
		synchronized (log) {
			if (log.isSaved()) {
				return;
			}
			if (this.intfLogService != null) {
				this.intfLogService.insert(log);
				log.setSaved(true);
			}
		}
	}

	public void insert(List<InterfaceLog> logs) {
		for (InterfaceLog log : logs) {
			this.insert(log);
		}
	}
}
